<template>
  <div>
    <a-button
      type="primary"
      @click="showDrawer"
    >Open</a-button>
    <a-drawer
      v-model:open="open"
      class="custom-class"
      root-class-name="root-class-name"
      :root-style="{ color: 'blue' }"
      style="color: red"
      title="Basic Drawer"
      placement="left"
      @after-open-change="afterOpenChange"
    >
      <template #extra>
        <a-button
          style="margin-right: 8px"
          @click="onClose"
        >Cancel</a-button>
        <a-button
          type="primary"
          @click="onClose"
        >Submit</a-button>
      </template>
      <a-form
        :model="form"
        layout="vertical"
      >
        <a-row :gutter="16">
          <a-col :span="12">
            <a-form-item
              label="Name"
              name="name"
            >
              <a-input
                v-model:value="form.name"
                placeholder="Please enter user name"
              />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item
              label="Url"
              name="url"
            >
              <a-input
                v-model:value="form.url"
                style="width: 100%"
                addon-before="http://"
                addon-after=".com"
                placeholder="please enter url"
              />
            </a-form-item>
          </a-col>
        </a-row>

      </a-form>
      <a-button
        type="primary"
        @click="showChildrenDrawer"
      >Two-level drawer</a-button>
      <a-drawer
        v-model:open="childrenDrawer"
        title="Two-level Drawer"
        width="320"
        :closable="false"
        placement="left"
      >
        <a-button
          type="primary"
          @click="showChildrenDrawer"
        >This is two-level drawer</a-button>
      </a-drawer>
    </a-drawer>

    <div style="width:400px;height: 200px;border:1px solid red;
      position: relative;">
      <div style="margin-top: 16px">
        <a-button
          type="primary"
          @click="showDrawer1"
        >Open</a-button>
      </div>
      <a-drawer
        title="Basic Drawer"
        placement="right"
        :closable="false"
        :open="open1"
        :get-container="false"
        :style="{ position: 'absolute' }"
        @close="onClose"
      >

      </a-drawer>
    </div>
  </div>
</template>

<script>
export default {
  name: '',
  components: {},
  data() {
    return {
      open: false,
      form: {
        name: '',
        url: '',
      },

      open1: false,
      childrenDrawer: false,
    }
  },
  created() { },
  mounted() { },
  methods: {
    showDrawer() {
      this.open = true
    },
    showDrawer1() {
      this.open1 = true
    },
    showChildrenDrawer() {
      this.childrenDrawer = true
    },
    afterOpenChange() {
      console.log(1);
    },
    onClose() {

    }
  },
  computed: {}
}
</script>
<style scoped lang='scss'>
</style>
